<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:View="using:StyleMVVM.View">

    <Style TargetType="View:CharmControl">
        <Setter Property="HeaderBackground">
            <Setter.Value>
                <SolidColorBrush Color="#1F0068"/>
            </Setter.Value>
        </Setter>
        <Setter Property="HeaderForeground" Value="White"/>
        <Setter Property="ContentBackground" Value="White"/>
        <Setter Property="ContentForeground" Value="Black"/>
        <Setter Property="BackButtonStyle">
            <Setter.Value>
                <Style TargetType="Button">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid
                                    Width="50"
                                    Height="50">
                                  <TextBlock
                                        Text="&#xE0A7;"
                                        FontFamily="Segoe UI Symbol"
                                        FontSize="41"
                                        Margin="8,-5,-8,5" />
                                  <TextBlock
                                        Text="&#xE112;"
                                        FontFamily="Segoe UI Symbol"
                                        FontSize="16"
                                        Margin="16,14,-16,-14" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="View:CharmControl">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Border BorderBrush="LightGray" BorderThickness="1"/>
                        <Grid Grid.Column="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="80"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid Grid.Row="0" Background="{TemplateBinding HeaderBackground}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="80"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.ChildrenTransitions>
                                    <TransitionCollection>
                                        <EntranceThemeTransition/>
                                    </TransitionCollection>
                                </Grid.ChildrenTransitions>
                                <Button Command="{TemplateBinding BackCommand}"
                                            Foreground="{TemplateBinding HeaderForeground}" Style="{TemplateBinding BackButtonStyle}" HorizontalAlignment="Right"  Margin="0,20,0,0"/>
                                <ContentControl Grid.Column="1" 
                                            Foreground="{TemplateBinding HeaderForeground}" 
                                            Content="{TemplateBinding HeaderContent}" VerticalAlignment="Center" FontSize="24" Margin="0,20,0,0"/>
                            </Grid>

                            <Grid Grid.Row="1" Background="{TemplateBinding ContentBackground}">
                                <Grid.ChildrenTransitions>
                                    <TransitionCollection>
                                        <EntranceThemeTransition/>
                                    </TransitionCollection>
                                </Grid.ChildrenTransitions>
                                <ContentPresenter Foreground="{TemplateBinding ContentForeground}"
                                              HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                            </Grid>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
